#!/bin/bash
#
# IBM Storwize V7000 volume/mdisk autodiscovery shell script for Zabbix
#
# 2012 Matvey Marinin
#
# Returns volume/mdisk/pool list in JSON format for "_Special_Storwize_Perf" Zabbix autodiscovery template:
# (http://www.zabbix.com/documentation/2.0/manual/discovery/low_level_discovery)
#
# Usage:
#   specify discovery rule with key svc_perf_discovery["{HOST.CONN}","volume-mdisk|volume|mdisk|pool"]
#
# Parameters:
#   $1 = SVC/Storwize cluster name (dev-svc, svc1-blk)
#   $2 = Requested object type, one of <volume-mdisk|pool>
#

set -e

. /etc/zabbix/externalscripts/svc_perf.conf

ERR_LOG=/var/cache/zabbix/svc_perf_discovery_debug 

#echo start `date` $1 $2 >> "$ERR_LOG"
/usr/bin/python /etc/zabbix/externalscripts/svc_perf_discovery.py --cluster "$1" --user "$WBEM_USER" --password "$WBEM_PWD" --type "$2" 2>>"$ERR_LOG"
#echo end `date` $1 $2 >> "$ERR_LOG"
